package model

import "gorm.io/gorm"

type Comment struct {
	gorm.Model
	CommentId string `gorm:"column:comment_id;type:CHAR(38)  NOT NULL; comment:评论id"`
	Author    string `gorm:"column:author;type:VARCHAR(32)  NOT NULL;  comment:评论人"`
	Content   string `gorm:"column:content;type:VARCHAR(1024) NOT NULL;  comment:评论内容"`
	PostId    string `json:"post_id" gorm:"column:post_id;type:CHAR(32)  NOT NULL;  comment:评论文章的id"`
	Email     string `json:"email" gorm:"column:email;type:CHAR(32)  NOT NULL;  comment:评论人的email"`
}
type CommentInfo struct {
	CommentId string `json:"comment_id"`
	Author    string `json:"author "`
	Content   string `json:"content "`
	PostId    string `json:"post_id "`
	Email     string `json:"email"`
}

func (Comment) TableName() string {
	return "comments"
}

type PostCommentInfo struct {
	PostId      string         `json:"post_id"`
	Title       string         `json:"title"`
	CommentList []*CommentMain `json:"comment_list"`
}
type CommentMain struct {
	CommentId string `json:"comment_id"`
	Author    string `json:"author"`
	Content   string `json:"content"`
	Email     string `json:"email"`
}
type PostComment struct {
	PostId    string `json:"post_id"`
	Title     string `json:"title"`
	CommentId string `json:"comment_id"`
	Author    string `json:"author"`
	Content   string `json:"content"`
	Email     string `json:"email"`
}
